samples: bluetooth: ble_hrs_peripheral_central: Add sample#721
Conversation
be076af to
c407df4
Compare
|
You can find the documentation preview for this PR here. |
6273968 to
e92a4af
Compare
e92a4af to
dace255
Compare
fc173b4 to
6c42f8e
Compare
451dc0d to
4a1fef8
Compare
763d8bb to
ebcd224
Compare
075266e to
cb12dff
Compare
cb12dff to
e918a4f
Compare
e918a4f to
ea320ab
Compare
ecd6c5f to
b19702a
Compare
1c5d2c7 to
2375283
Compare
| This sample advertises and scans for devices that advertise with the :ref:`lib_ble_service_hrs` UUID (0x180D) and initiates a connection when a device is found. | ||
| When a peripheral device is connected, the sample starts the service discovery procedure. | ||
| If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications. | ||
| If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. |
There was a problem hiding this comment.
I think this could use a rewrite. Perhaps something like.
| This sample advertises and scans for devices that advertise with the :ref:`lib_ble_service_hrs` UUID (0x180D) and initiates a connection when a device is found. | |
| When a peripheral device is connected, the sample starts the service discovery procedure. | |
| If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications. | |
| If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. | |
| This sample acts simultaneously as both a peripheral and central device. | |
| * As a peripheral the sample advertises with the :ref:`lib_ble_service_hrs` UUID (0x180D). If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. | |
| * As a central the sample scans for other devices that advertise with the :ref:`lib_ble_service_hrs` UUID (0x180D). When a device is found it initiates a connection before starting the service discovery procedure and subscribing to the Heart Rate Measurement characteristic notifications. |
There was a problem hiding this comment.
Rewrote. Please have another look.
| Useful for: | ||
| * **Development**: Multiple HRS devices nearby, only want to connect to yours. | ||
| * **Production**: Bridge paired with one specific sensor, ignore everything else. | ||
| * **Bonded scenarios**: Combine with allow lists for tighter control. | ||
| Note: "peripheral" in the option name refers to the *remote* device being scanned | ||
| for, not this device's role. |
There was a problem hiding this comment.
I agree that the bullet points sound a bit like marketing content and don't really bring in new technical information. Please remove the bullets but retain the note, this is actually important.
| Useful for: | |
| * **Development**: Multiple HRS devices nearby, only want to connect to yours. | |
| * **Production**: Bridge paired with one specific sensor, ignore everything else. | |
| * **Bonded scenarios**: Combine with allow lists for tighter control. | |
| Note: "peripheral" in the option name refers to the *remote* device being scanned | |
| for, not this device's role. | |
| .. note:: | |
| ``peripheral`` in the option name refers to the *remote* device being scanned for, not this device's role. |
There was a problem hiding this comment.
Removed bullet points. Kept the note.
| #. Note the address printed in the log when connecting, e.g: | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| Connecting to target AA:BB:CC:DD:EE:FF | ||
|
|
||
| #. Enable the address filter in Kconfig with: | ||
|
|
||
| .. code-block:: cfg | ||
|
|
||
| CONFIG_SAMPLE_USE_TARGET_PERIPHERAL_ADDR=y | ||
| CONFIG_SAMPLE_TARGET_PERIPHERAL_ADDR=0xAABBCCDDEEFF | ||
|
|
||
| Rebuild and flash. Confirm the sample still connects to the same peripheral. | ||
| #. Change the address to a wrong value, rebuild and flash. Confirm the sample no | ||
| longer connects to any peripheral. | ||
| #. Repeat the same flow with :kconfig:option:`CONFIG_SAMPLE_USE_TARGET_PERIPHERAL_NAME` | ||
| (easier, uses the advertised name). |
There was a problem hiding this comment.
I don't think we should keep this in the test steps, what do you think @anhmolt?
| Testing | ||
| ======= | ||
|
|
||
| This sample can be tested with three devices, |
There was a problem hiding this comment.
| This sample can be tested with three devices, |
| ======= | ||
|
|
||
| This sample can be tested with three devices, | ||
| This sample can be tested with three devices, one running this sample, another one running the :ref:`ble_hrs_sample` sample, and a central, for example, a phone or a tablet with `nRF Connect for Mobile`_ or `nRF Toolbox`_. |
There was a problem hiding this comment.
| This sample can be tested with three devices, one running this sample, another one running the :ref:`ble_hrs_sample` sample, and a central, for example, a phone or a tablet with `nRF Connect for Mobile`_ or `nRF Toolbox`_. | |
| This sample can be tested with three devices: | |
| * A device running this sample. | |
| * A device running the :ref:`ble_hrs_sample` sample. | |
| * A central device, for example, a phone or a tablet with `nRF Connect for Mobile`_ or `nRF Toolbox`_. |
| * - Kconfig option | ||
| - Matches on | ||
| * - :kconfig:option:`CONFIG_SAMPLE_USE_TARGET_PERIPHERAL_NAME` | ||
| - Advertised device name (eks: ``"MyDeviceName"``) |
There was a problem hiding this comment.
| - Advertised device name (eks: ``"MyDeviceName"``) | |
| - Advertised device name (e.g. ``"MyDeviceName"``) |
| This sample advertises and scans for devices that advertise with the :ref:`lib_ble_service_hrs` UUID (0x180D) and initiates a connection when a device is found. | ||
| When a peripheral device is connected, the sample starts the service discovery procedure. | ||
| If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications. | ||
| If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. |
There was a problem hiding this comment.
| If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. | |
| If a central connects to this device, the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. |
|
|
||
| Scan filtering options | ||
| ====================== | ||
| The sample always scans for devices advertising the Heart Rate Service UUID |
There was a problem hiding this comment.
| The sample always scans for devices advertising the Heart Rate Service UUID | |
| The sample always scans for devices advertising the Heart Rate Service UUID (``0x180D``). |
| Scan filtering options | ||
| ====================== | ||
| The sample always scans for devices advertising the Heart Rate Service UUID | ||
| (``0x180D``). Two optional filters can narrow this down further: |
There was a problem hiding this comment.
| (``0x180D``). Two optional filters can narrow this down further: | |
| Two optional filters can narrow this down further: |
| Useful for: | ||
| * **Development**: Multiple HRS devices nearby, only want to connect to yours. | ||
| * **Production**: Bridge paired with one specific sensor, ignore everything else. | ||
| * **Bonded scenarios**: Combine with allow lists for tighter control. | ||
| Note: "peripheral" in the option name refers to the *remote* device being scanned | ||
| for, not this device's role. |
There was a problem hiding this comment.
I agree that the bullet points sound a bit like marketing content and don't really bring in new technical information. Please remove the bullets but retain the note, this is actually important.
| Useful for: | |
| * **Development**: Multiple HRS devices nearby, only want to connect to yours. | |
| * **Production**: Bridge paired with one specific sensor, ignore everything else. | |
| * **Bonded scenarios**: Combine with allow lists for tighter control. | |
| Note: "peripheral" in the option name refers to the *remote* device being scanned | |
| for, not this device's role. | |
| .. note:: | |
| ``peripheral`` in the option name refers to the *remote* device being scanned for, not this device's role. |
| If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications. | ||
| If a central connects to this device the central subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications forwarded from the peripheral device. | ||
|
|
||
| .. _ble_hrs_peripheral_central_sample_testing: |
There was a problem hiding this comment.
this label should be moved before 'Building and running'
There was a problem hiding this comment.
Good catch. I see the same in the NUS central and HRS central sample READMEs. I'll fix in #799.
2375283 to
9595bee
Compare
Fix connected event handling to ignore connections where the local device have the central role. Disconnect events should only reset the ble_hrs stored conn_handle if the disconnect event carries the same conn_handle. Co-authored-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no> Co-authored-by: Asil Zogby <asil.zogby@nordicsemi.no> Signed-off-by: Sondre Pettersen <sondre.pettersen@nordicsemi.no>
Add body sensor location event. Signed-off-by: Sondre Pettersen <sondre.pettersen@nordicsemi.no> Co-authored-by: Asil Zogby <asil.zogby@nordicsemi.no>
9595bee to
41adcab
Compare
Add the hrs_peripheral_central sample. Co-authored-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no> Co-authored-by: Asil Zogby <asil.zogby@nordicsemi.no> Signed-off-by: Sondre Pettersen <sondre.pettersen@nordicsemi.no>
41adcab to
3bf3cce
Compare
Adds the hrs_peripheral_central sample.